import { createApp } from "vue"
import App from "./App.vue"
import { createPinia } from "pinia"
import { createRouter, createWebHashHistory } from "vue-router"
import { routes } from "./route"
import "@unocss/reset/tailwind-compat.css"
import "virtual:uno.css"
import { init } from "./store"

init()
    .then(async () => {
        const pinia = createPinia()
        const router = createRouter({
            routes,
            history: createWebHashHistory(),
        })
        const app = createApp(App)

        app.use(pinia)
        app.use(router)

        app.mount("#app")
    })
    .catch((e) => {
        alert("初始化失败，快跑！")
        console.error(e)
    })
